package com.module.product.manager;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.Session;

import base.dao.GenericHibernateDao;
import base.db.HibernateSessionFactory;
import base.manager.GenericHibernateManager;

import com.module.product.dao.AttrValueTemporaryDao;
import com.module.product.vo.AttrValueTemporary;

public class AttrValueTemporaryManager extends GenericHibernateManager<AttrValueTemporary, String>{
	
	static Logger logger = Logger.getLogger(AttrValueTemporaryManager.class.getName());
	private AttrValueTemporaryManager(){
		
	}
    private static final AttrValueTemporaryManager instance = new AttrValueTemporaryManager();
	
	
	public synchronized static AttrValueTemporaryManager getInstance() {
		return instance;
	}
	
	
	AttrValueTemporaryDao dao = AttrValueTemporaryDao.getInstance();
	
	public List findAttrByProductId(String productId) throws Exception{
		Session session =HibernateSessionFactory.getSession();
		List<AttrValueTemporary> list  = new ArrayList();
		try{
		    	list = dao.findAttrByProductId(session,productId);	
	    	}catch(Exception e){
	    		throw e;
	    		
	    	}finally{
	    		this.closeSession();
	    	}
		return list;
	}

	@Override
	public GenericHibernateDao<AttrValueTemporary, String> getDao() {
		// TODO Auto-generated method stub
		return dao;
	}
}
